<!-- 用户中心页 -->
<!Doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>用户中心页</title>
    <meta name="keywords" content="${keywords}"/>
    <meta name="description" content="${description}"/>
    <link rel="shortcut icon" type="image/x-icon" th:href="@{'/static/images/favicon.ico'}" media="screen" />

    <link th:href="@{'/static/css/common.css'}" type="text/css" rel="stylesheet">
    <link th:href="@{'/static/css/themify-icons/style.css'}" type="text/css" rel="stylesheet">
    <script language="javascript" th:src="@{'/static/js/tool.js'}" type="text/javascript"></script>
    <script language="javascript" th:src="@{'/static/js/ajax.js'}" type="text/javascript"></script>
    <script language="javascript" th:src="@{'/static/js/json2.js'}" type="text/javascript"></script>
    <script type="text/javascript" th:src="@{'/static/js/jquery/jquery.min.js'}" language="javascript"></script>
    <script type="text/javascript" th:src="@{'/static/js/jquery/jquery.letterAvatar.js'}"
            language="javascript"></script>
    <script type="text/javascript" th:src="@{'/static/js/jquery/readmore.min.js'}" language="javascript"></script>
    <link th:href="@{'/static/js/layer/skin/default/layer.css'}" type="text/css" rel="stylesheet"/>
    <script type="text/javascript" th:src="@{'/static/js/layer/layer.js'}" language="javascript"></script>


    <script type="text/javascript" th:src="@{'/static/js/DPlayer/hls.min.js'}" language="javascript"></script>
    <script type="text/javascript" th:src="@{'/static/js/DPlayer/DPlayer.min.js'}" language="javascript"></script>

    <link th:href="@{'/static/js/prism/default-block/prism.css'}" type="text/css" rel="stylesheet"/>
    <script type="text/javascript" th:src="@{'/static/js/prism/default-block/prism.js'}" language="javascript"></script>
    <script type="text/javascript" th:src="@{'/static/js/prism/default-block/clipboard.min.js'}"
            language="javascript"></script>
</head>
<body>


<!-- 引入页头 -->
<div th:include="public/newPublic_2"></div>
<div class="skeleton">
    <div class="main wrap">
        <div class="user-home-header" style="width: 1205px;">
            <div class="avatarRing"></div>
            <div class="inner clearfix">
                <div class="avatar">
                    <div class="img-box">
                        <img th:if="${session.userList.getAvatarname()!=null}" th:src="@{'/readImg'+${session.userList.avatarname}}"/>

                        <!--[if !(IE)]><!--><img th:if="${session.userList.getAvatarname()==null}" width="140px" height="140px"
                                                 th:src="@{'/static/images/min_avata.png'}" />
                        <!--<![endif]-->

                    </div>
                    <div class="counts clearfix">
                        <div class="follows">
                            <div id="followerCount" class="num" th:text="${session.userList.getFace_num()}">0</div>
                            <div class="sub">粉丝</div>
                            <input type="hidden" id="_userName" th:value="${session.userList.getFace_num()}"/>
                        </div>
                        <script language="javascript" type="text/javascript">
                            //查询粉丝总数
                            function queryFollowerCount() {
                                //获取用户名称
                                var userName = document.getElementById("_userName").value;
                                get_request(function (value) {
                                    if (value != "") {
                                        var data = JSON.parse(value);
                                        document.getElementById("followerCount").innerHTML = data;
                                    }
                                },
                                    "queryFollowerCount.htm?userName=" + userName + "&timestamp=" + new Date().getTime(), true);
                            }

                            queryFollowerCount();
                        </script>

                    </div>
                </div>
                <div class="head-line">
                    <div class="name" th:if="${session.userList.username!=null}"
                         th:text="${session.userList.username}"></div>
                    <!--            <div class="grade">${user.gradeName}</div>-->

                </div>
                <div th:if="${session.userList.nikename!=null}" class="nickname">
                    呢称：<label th:text="${session.userList.nikename}"></label>
                </div>
            </div>
            <div class="clearfix"></div>
            <div class="action-button">
                <!--    <#if user.userName != null && user.userName != systemUser.userName>-->
                <!--    <#&#45;&#45; 引入关注用户 &ndash;&gt;-->
                <!--    <@include action="${followRelated_addFollow_1}"/>-->

                <!--    <span class="privateMessageBox">-->
                <!--							<button type="button" class="privateMessageButton"-->
                <!--                                    onClick="javascript:window.location.href='${baseURL}user/control/privateMessageChatList?friendUserName=${user.userName}'">发私信</button>-->
                <!--						</span>-->
                <!--</-->
                <!--#if>-->
            </div>

        </div>


        <div class="selfService clearfix">
            <div class="box">
                <ul class="ul">
<!--                    <li class="item">-->
<!--                        <a class="a-pic" href="user/control/userDynamicList">-->
<!--                            <div class="img cms-pulse"></div>-->
<!--                        </a>-->
<!--                        <h4 class="title">-->
<!--                            <a class="a-title" href="user/control/userDynamicList">我的动态</a>-->
<!--                        </h4>-->
<!--                    </li>-->
<!--                    <li class="item">-->
<!--                        <a class="a-pic" href="user/control/topicList">-->
<!--                            <div class="img cms-topic"></div>-->
<!--                        </a>-->
<!--                        <h4 class="title">-->
<!--                            <a class="a-title" href="user/control/topicList">我的话题</a>-->
<!--                        </h4>-->
<!--                    </li>-->
                    <li class="item">
                        <a class="a-pic" th:href="@{/user/control/commentList}">
                            <div class="img cms-comment"></div>
                        </a>
                        <h4 class="title">
                            <a class="a-title" th:href="@{/user/control/commentList}">我的评论</a>
                        </h4>
                    </li>
                    <li class="item">
                        <a class="a-pic" th:href="@{/user/control/commentReply}">
                            <div class="img cms-reply " style=""></div>
                        </a>
                        <h4 class="title">
                            <a class="a-title" th:href="@{/user/control/commentReply}">我的回复</a>
                        </h4>
                    </li>
<!--                    <li class="item">-->
<!--                        <a class="a-pic" href="user/control/questionList">-->
<!--                            <div class="img cms-help-alt"></div>-->
<!--                        </a>-->
<!--                        <h4 class="title">-->
<!--                            <a class="a-title" href="user/control/questionList">我的问题</a>-->
<!--                        </h4>-->
<!--                    </li>-->
<!--                    <li class="item">-->
<!--                        <a class="a-pic" href="user/control/answerList">-->
<!--                            <div class="img cms-info-alt"></div>-->
<!--                        </a>-->
<!--                        <h4 class="title">-->
<!--                            <a class="a-title" href="user/control/answerList">我的答案</a>-->
<!--                        </h4>-->
<!--                    </li>-->
<!--                    <li class="item">-->
<!--                        <a class="a-pic" href="user/control/answerReplyList">-->
<!--                            <div class="img cms-reply "></div>-->
<!--                        </a>-->
<!--                        <h4 class="title">-->
<!--                            <a class="a-title" href="user/control/answerReplyList">我的答案回复</a>-->
<!--                        </h4>-->
<!--                    </li>-->
<!--                    <li class="item">-->
<!--                        <a class="a-pic" href="user/control/favoriteList">-->
<!--                            <div class="img cms-favorites"></div>-->
<!--                        </a>-->
<!--                        <h4 class="title">-->
<!--                            <a class="a-title" href="user/control/favoriteList">收藏夹</a>-->
<!--                        </h4>-->
<!--                    </li>-->
                    <li class="item">
                        <a class="a-pic" th:href="@{/user/control/likeList}">
                            <div class="img cms-thumb-up"></div>
                        </a>
                        <h4 class="title">
                            <a class="a-title" th:href="@{/user/control/likeList}">点赞</a>
                        </h4>
                    </li>
                    <li class="item">
                        <a class="a-pic" th:href="@{/user/control/focus}">
                            <div class="img cms-heart"></div>
                        </a>
                        <h4 class="title">
                            <a class="a-title" th:href="@{/user/control/focus}">关注</a>
                        </h4>
                    </li>
<!--                    <li class="item">-->
<!--                        <a class="a-pic" th:href="">-->
<!--                            <div class="img cms-follower"></div>-->
<!--                        </a>-->
<!--                        <h4 class="title">-->
<!--                            <a class="a-title" href="user/control/followerList">粉丝</a>-->
<!--                        </h4>-->
<!--                    </li>-->
<!--                    <li class="item">-->
<!--                        <a class="a-pic" href="user/control/privateMessageList">-->
<!--                            <div class="img cms-email"></div>-->
<!--                        </a>-->
<!--                        <h4 class="title">-->
<!--                            <a class="a-title" href="user/control/privateMessageList">-->
<!--                                私信<span id="privateMessage-badge" class="badge"-->
<!--                                        style="position: absolute; margin-top: -1px; display: none;"></span>-->
<!--                            </a>-->
<!--                        </h4>-->
<!--                    </li>-->
<!--                    <li class="item">-->
<!--                        <a class="a-pic" href="user/control/remindList">-->
<!--                            <div class="img cms-bell"></div>-->
<!--                        </a>-->
<!--                        <h4 class="title">-->
<!--                            <a class="a-title" href="user/control/remindList">-->
<!--                                提醒<span id="remind-badge" class="badge"-->
<!--                                        style="position: absolute; margin-top: -1px; display: none;"></span>-->
<!--                            </a>-->
<!--                        </h4>-->
<!--                    </li>-->
<!--                    <li class="item">-->
<!--                        <a class="a-pic" href="user/control/systemNotifyList">-->
<!--                            <div class="img cms-announcement"></div>-->
<!--                        </a>-->
<!--                        <h4 class="title">-->
<!--                            <a class="a-title" href="user/control/systemNotifyList">-->
<!--                                系统通知<span id="systemNotify-badge" class="badge"-->
<!--                                          style="position: absolute; margin-top: -1px; display: none;"></span>-->
<!--                            </a>-->
<!--                        </h4>-->
<!--                    </li>-->

                    <li class="item">
                        <a class="a-pic" th:href="@{/user/control/editUser}">
                            <div class="img cms-pencil-alt"></div>
                        </a>
                        <h4 class="title">
                            <a class="a-title" th:href="@{/user/control/editUser}">修改个人资料</a>
                        </h4>
                    </li>

<!--                    <li class="item">-->
<!--                        <a class="a-pic" href="user/control/point">-->
<!--                            <div class="img cms-point"></div>-->
<!--                        </a>-->
<!--                        <h4 class="title">-->
<!--                            <a class="a-title" href="user/control/point">积分日志</a>-->
<!--                        </h4>-->
<!--                    </li>-->
                    <li class="item">
                        <a class="a-pic" th:href="@{/user/control/userLoginLogList}">
                            <div class="img cms-log"></div>
                        </a>
                        <h4 class="title">
                            <a class="a-title" th:href="@{/user/control/userLoginLogList}">登录日志</a>
                        </h4>
                    </li>
                </ul>
            </div>
        </div>

        <!--<#if user.userName != systemUser.userName>-->
        <!-- 动态 -->
        <div id="home-userDynamic" class="home-userDynamic" style="width: 1205px;">

        </div>
        <!-- 动态内容加载中 -->
        <div id="load" class="loader" style="display: none;">加载中，请稍后...</div>
        <!--</#if>-->
        <input type="hidden" id="commonPath" value="${commonPath}"/>
        <!-- 是否登录 -->
        <input type="hidden" id="unhide_isLogin" value="<#if systemUser != null>true<#else>false</#if>">


        <script type="text/javascript">
            //创建动态列表
            function createUserDynamicList(pageView) {
                var html = "";
                var commonPath = document.getElementById("commonPath").value;

                if (pageView.records != null && pageView.records.length > 0) {
                    html += "<div class='userDynamicModule' >";
                    html += "<ol class='userDynamicList'>";
                    for (var i = 0; i < pageView.records.length; i++) {
                        var userDynamic = pageView.records[i];

                        html += "<div class='userDynamic'>";
                        html += "<div class='userDynamic-author'>";
                        html += "<a href='user/control/home?userName=" + userDynamic.userName + "'>";
                        if (userDynamic.avatarName != null && userDynamic.avatarName != '') {
                            html += "<img src='" + userDynamic.avatarPath + "100x100/" + userDynamic.avatarName + "' >";
                        } else {

                            html += "<!--[if (IE)]><img src='" + commonPath + "images/min_avata.png'><![endif]-->";

                            if (userDynamic.nickname != null && userDynamic.nickname != '') {
                                html += "<!--[if !(IE)]><!--><img avatar='" + userDynamic.nickname + "' ><!--<![endif]-->";
                            } else {
                                html += "<!--[if !(IE)]><!--><img avatar='" + userDynamic.userName + "' ><!--<![endif]-->";
                            }

                        }
                        html += "";
                        html += "";
                        html += "<cite>";
                        html += "<a class='userName' href='user/control/home?userName=" + userDynamic.userName + "'>";
                        if (userDynamic.nickname != null && userDynamic.nickname != '') {
                            html += userDynamic.nickname;
                        } else {
                            html += userDynamic.userName;
                        }
                        html += "</a>";
                        html += "</cite> ";
                        html += "</div>";
                        html += "<div class='userDynamicTime'>" + userDynamic.postTime + "</div>";
                        html += "<div class='topicTitle'>";
                        if (userDynamic.module == 100) {
                            html += "<span class='info'>发表了话题</span>";
                            html += "<a href='thread?topicId=" + userDynamic.topicId + "'> " + userDynamic.topicTitle + "</a>";
                        } else if (userDynamic.module == 200) {
                            html += "<span class='info'>评论了话题</span>";
                            html += "<a href='thread?topicId=" + userDynamic.topicId + "'> " + userDynamic.topicTitle + "</a>";
                        } else if (userDynamic.module == 300) {
                            html += "<span class='info'>引用了话题</span>";
                            html += "<a href='thread?topicId=" + userDynamic.topicId + "'> " + userDynamic.topicTitle + "</a>";
                        } else if (userDynamic.module == 400) {
                            html += "<span class='info'>回复了话题</span>";
                            html += "<a href='thread?topicId=" + userDynamic.topicId + "'> " + userDynamic.topicTitle + "</a>";
                        } else if (userDynamic.module == 500) {
                            html += "<span class='info'>提交了问题</span>";
                            html += "<a href='question?questionId=" + userDynamic.questionId + "'> " + userDynamic.questionTitle + "</a>";
                        } else if (userDynamic.module == 600) {
                            html += "<span class='info'>回答了问题</span>";
                            html += "<a href='question?questionId=" + userDynamic.questionId + "'> " + userDynamic.questionTitle + "</a>";
                        } else if (userDynamic.module == 700) {
                            html += "<span class='info'>回复了问题</span>";
                            html += "<a href='question?questionId=" + userDynamic.questionId + "'> " + userDynamic.questionTitle + "</a>";
                        }


                        for (var j = 0; j < userDynamic.allowRoleViewList.length; j++) {
                            var roleName = userDynamic.allowRoleViewList[j];
                            html += "<i class='topicRoleName'>" + roleName + "</i>";

                        }

                        for (var key in userDynamic.hideTagTypeMap) {
                            var flag = userDynamic.hideTagTypeMap[key];
                            html += "<span class='hideTagType hide_" + key + "' data='" + key + "'>";
                            if (flag == true) {
                                html += "<span class='circle point'><i class='cms-unlock-solid' ></i></span>";
                            } else {
                                html += "<span class='circle'><i class='cms-lock-solid' ></i></span>";
                            }

                            html += "</span> ";
                        }

                        html += "</div>";
                        if (userDynamic.module == 100) {
                            html += "<div class='topicContent' topicId='" + userDynamic.topicId + "' >" + userDynamic.topicContent + "</div>";
                        }
                        if (userDynamic.module == 200) {
                            html += "<div class='topicContent' >" + userDynamic.commentContent + "</div>";
                        }
                        if (userDynamic.module == 300) {
                            html += "<div id='quoteModuleContent' >";
                            html += "<div class='commentContent' >" + userDynamic.commentContent + "</div>";
                            html += "<div class='quoteContent'>";
                            html += "<div class='text'>";
                            html += userDynamic.quoteCommentContent;
                            html += "</div>";
                            html += "</div>";
                            html += "</div>";
                        }
                        if (userDynamic.module == 400) {
                            html += "<div class='replyContent' >" + userDynamic.replyContent + "</div>";
                        }
                        if (userDynamic.module == 500) {
                            html += "<div class='topicContent' >" + userDynamic.questionContent + "</div>";
                        }
                        if (userDynamic.module == 600) {
                            html += "<div class='topicContent' >" + userDynamic.answerContent + "</div>";
                        }
                        if (userDynamic.module == 700) {
                            html += "<div class='replyContent' >" + userDynamic.answerReplyContent + "</div>";
                        }
                        html += "<div class='clearfix'></div>";
                        html += "<div class='tipBottom'>";
                        html += "<span class='a-toolbar'>";


                        if (userDynamic.module == 100) {
                            html += "<a href='thread?topicId=" + userDynamic.topicId + "' target='_blank' >查看原文</a>";

                            html += "<span >" + userDynamic.topicViewTotal + "次阅读</span>";
                            html += "<span >" + userDynamic.topicCommentTotal + "个评论</span>";
                            html += "<span id='favoriteCount_" + userDynamic.topicId + "'>0人收藏</span>";
                            html += "<span id='likeCount_" + userDynamic.topicId + "'>0人赞</span>";
                        } else if (userDynamic.module == 200) {
                            html += "<a href='thread?topicId=" + userDynamic.topicId + "&commentId=" + userDynamic.commentId + "'  target='_blank' >查看原文</a>";
                        } else if (userDynamic.module == 300) {
                            html += "<a href='thread?topicId=" + userDynamic.topicId + "&commentId=" + userDynamic.commentId + "'  target='_blank' >查看原文</a>";
                        } else if (userDynamic.module == 400) {
                            html += "<a href='thread?topicId=" + userDynamic.topicId + "&commentId=" + userDynamic.commentId + "'  target='_blank' >查看原文</a>";
                        } else if (userDynamic.module == 500) {
                            html += "<a href='question?questionId=" + userDynamic.questionId + "' target='_blank' >查看原文</a>";
                            html += "<span >" + userDynamic.questionViewTotal + "次阅读</span>";
                            html += "<span >" + userDynamic.questionAnswerTotal + "个回答</span>";
                            html += "<span id='questionFavoriteCount_" + userDynamic.questionId + "'>0人收藏</span>";
                        } else if (userDynamic.module == 600) {
                            html += "<a href='question?questionId=" + userDynamic.questionId + "&answerId=" + userDynamic.answerId + "'  target='_blank' >查看原文</a>";
                        } else if (userDynamic.module == 700) {
                            html += "<a href='question?questionId=" + userDynamic.questionId + "&answerId=" + userDynamic.answerId + "'  target='_blank' >查看原文</a>";
                        }
                        html += "</span>";
                        html += "</div>";
                        html += "</div>";

                    }
                    html += "</ol>";
                    html += "</div>";
                }
                //document.getElementById("home-userDynamic").innerHTML = html;
                $("#home-userDynamic").append(html);

                setTimeout(function () {
                    //生成头像
                    LetterAvatar.transform();


                    if (pageView.records != null && pageView.records.length > 0) {
                        for (var i = 0; i < pageView.records.length; i++) {
                            var userDynamic = pageView.records[i];
                            if (userDynamic.module == 100) {
                                queryFavoriteCount(userDynamic.topicId);
                                queryLikeCount(userDynamic.topicId);
                            }
                            if (userDynamic.module == 500) {
                                queryQuestionFavoriteCount(userDynamic.questionId);
                            }
                        }
                    }
                }, 100);


            }

            //查询话题用户收藏总数
            function queryFavoriteCount(topicId) {
                get_request(function (value) {
                    if (value != "") {
                        var data = JSON.parse(value);
                        document.getElementById("favoriteCount_" + topicId).innerHTML = data + "人收藏";
                    }
                },
                    "queryFavoriteCount?topicId=" + topicId + "&timestamp=" + new Date().getTime(), true);

            }

            //查询话题用户点赞总数
            function queryLikeCount(topicId) {
                get_request(function (value) {
                    if (value != "") {
                        var data = JSON.parse(value);
                        document.getElementById("likeCount_" + topicId).innerHTML = data + "人赞";
                    }
                },
                    "queryLikeCount?topicId=" + topicId + "&timestamp=" + new Date().getTime(), true);

            }

            //查询问题用户收藏总数
            function queryQuestionFavoriteCount(questionId) {
                get_request(function (value) {
                    if (value != "") {
                        var data = JSON.parse(value);
                        document.getElementById("questionFavoriteCount_" + questionId).innerHTML = data + "人收藏";
                    }
                },
                    "queryQuestionFavoriteCount?questionId=" + questionId + "&timestamp=" + new Date().getTime(), true);

            }


            // 获取随机数
            function getRandom(m) {
                //生成的随机数截取m位，生成的随机数最大不超过13位，能保证首位不为0
                m = m > 13 ? 13 : m;
                var num = Math.random().toString();
                if (num.substr(num.length - m, 1) === '0') {
                    return getRandom(m);
                }
                return num.substring(num.length - m);
            }

            //设置隐藏标签界面
            function setHideTagUI() {
                //获取<hide>标签属性
                $(".topicContent").find("hide").each(function () {
                    var random = getRandom(13);

                    //等级名称
                    var gradeName = $(this).attr("description");
                    var hideType = $(this).attr("hide-type");

                    //话题Id
                    var topicId = $(this).parents(".topicContent").attr("topicId");//找到父级元素属性

                    var inputValue = $(this).attr("input-value");
                    if (hideType == '10') {
                        var html = "";
                        html += '<div class="hide-box">';
                        html += '<div class="background-image"></div>';
                        html += '<div class="background-prompt">此处内容已被隐藏，输入密码可见</div>';
                        html += '<div class="input-box">';
                        html += '<input type="password" id="hide_password_' + random + '" class="text" maxlength="30"  placeholder="密码" value="">';
                        html += '<input type="button" value="提交" class="button" onclick="topicUnhide(10,' + random + ',' + topicId + ');">';

                        html += '</div>';
                        html += '</div>';
                        $(this).html(html);
                    } else if (hideType == '20') {
                        var html = "";
                        html += '<div class="hide-box">';
                        html += '<div class="background-image"></div>';
                        html += '<div class="background-prompt">此处内容已被隐藏，评论话题可见</div>';
                        html += '</div>';
                        $(this).html(html);
                    } else if (hideType == '30') {
                        var html = "";
                        html += '<div class="hide-box">';
                        html += '<div class="background-image"></div>';
                        html += '<div class="background-prompt">此处内容已被隐藏，等级达到‘' + gradeName + '’可见</div>';
                        html += '</div>';
                        $(this).html(html);
                    } else if (hideType == '40') {
                        var html = "";
                        html += '<div class="hide-box">';
                        html += '<div class="background-image"></div>';
                        html += '<div class="background-prompt">此处内容已被隐藏，支付 ' + inputValue + ' 积分可见</div>';
                        html += '<div class="submit-box">';
                        html += '<input type="button" value="立即购买" class="button" onclick="topicUnhide(40,' + random + ',' + topicId + ');">';

                        html += '</div>';
                        $(this).html(html);
                    } else if (hideType == '50') {
                        var html = "";
                        html += '<div class="hide-box">';
                        html += '<div class="background-image"></div>';
                        html += '<div class="background-prompt">此处内容已被隐藏，支付￥<span class="highlight">' + inputValue + ' </span>元可见</div>';
                        html += '<div class="submit-box">';
                        html += '<input type="button" value="立即购买" class="button" onclick="topicUnhide(50,' + random + ',' + topicId + ');">';

                        html += '</div>';
                        $(this).html(html);
                    }
                })

            }

            //话题取消隐藏
            function topicUnhide(hideType, random, topicId) {

                //判断是否已登录
                var isLogin = document.getElementById("unhide_isLogin").value;
                if (isLogin == "false") {
                    layer.open({
                        type: 1,
                        title: "提示",
                        content: "<div style='line-height: 36px; font-size: 15px;text-align:center; margin-left: 8px;margin-right: 8px;'>请先登录</div>",
                        area: ['260px', '120px'],//宽高
                        success: function (layero, index) {

                        }
                    });
                    return false;
                }


                var confirm_index = layer.confirm('是否确认解锁？', {
                    btn: ['解锁', '取消'] //按钮
                }, function () {//解锁
                    layer.close(confirm_index); //关闭层
                    var parameter = "";
                    parameter += "&topicId=" + topicId;//话题Id

                    parameter += "&hideType=" + hideType;//隐藏类型

                    if (hideType == 10) {//输入密码可见

                        var password = $.trim($('#hide_password_' + random).val());
                        if (password == "") {
                            layer.open({
                                type: 1,
                                title: "提示",
                                content: "<div style='line-height: 36px; font-size: 15px;text-align:center; margin-left: 8px;margin-right: 8px;'>密码不能为空</div>",
                                area: ['260px', '120px'],//宽高
                                end: function (layero, index) {

                                }
                            });
                            return;
                        }
                        parameter += "&password=" + encodeURIComponent(password);//获取URL参数

                    }
                    //从meta标签获取令牌
                    parameter += "&token=" + getCsrf();
                    //删除第一个&号,防止因为多了&号而出现警告: Parameters: Invalid chunk ignored.信息
                    if (parameter.indexOf("&") == 0) {
                        parameter = parameter.substring(1, parameter.length);
                    }
                    post_request(function (value) {
                        var data = JSON.parse(value);
                        for (var returnValue in data) {

                            if (returnValue == "success") {
                                if (data[returnValue] == "true") {
                                    //需引入layer
                                    layer.msg('话题取消隐藏成功，5秒后自动刷新页面',
                                        {
                                            time: 5000 //3秒关闭（如果不配置，默认是3秒）
                                        }, function () {
                                            //关闭后的操作
                                            //刷新页面
                                            document.location.reload();
                                        }
                                    );


                                }
                            } else if (returnValue == "error") {

                                var errorValue = data[returnValue];
                                var htmlValue = "";
                                var i = 0;
                                for (var error in errorValue) {
                                    if (error != "") {
                                        i++;
                                        htmlValue += "&nbsp;&nbsp;" + i + "、" + errorValue[error] + "<br>";
                                    }
                                }

                                layer.open({
                                    type: 1,
                                    title: '错误',
                                    skin: 'layui-layer-rim', //加上边框
                                    area: ['300px', '150px'], //宽高
                                    content: "<div style='line-height: 36px; font-size: 15px;text-align:left; margin-left: 8px;margin-right: 8px;'>" + htmlValue + "</div>"
                                });
                            }
                        }
                    },
                        "user/control/topic/unhide?timestamp=" + new Date().getTime(), true, parameter);

                }, function () {//取消

                });
            }


            //查询动态列表
            function queryUserDynamicList(callback, page) {
                var userName = getUrlParam("userName");//从URL中获取
                if (userName != "") {
                    //查询用户动态
                    $.ajax({
                        type: "GET",
                        cache: false,
                        async: true,//默认值: true。默认设置下，所有请求均为异步请求。如果需要发送同步请求，请将此选项设置为 false。
                        url: "user/control/userDynamicList?userName=" + userName + "&page=" + page,
                        //data: data,
                        success: function (result) {
                            if (result.records != null && result.records.length > 0) {
                                //创建动态内容
                                createUserDynamicList(result);

                                setTimeout(function () {
                                    setHideTagUI();
                                    //设置播放器标签
                                    setPlayerTag();

                                    //代码高亮
                                    codeHighlight();

                                    //隐藏高度超过100px的内容
                                    $('.topicContent,#quoteModuleContent').readmore({
                                        speed: 100,//速度
                                        collapsedHeight: 200,//默认高度
                                        moreLink: '<a href="" class="readMore">阅读全文</a>',
                                        lessLink: '<a href="" class="readMore">收起</a>',
                                        afterToggle: function (trigger, element, expanded) {
                                            console.log();
                                            if (expanded) {//收缩
                                                element.next().addClass('shrinkMore');
                                                element.next().removeClass('readMore');
                                            } else {//展开
                                                element.next().addClass('readMore');
                                                element.next().removeClass('shrinkMore');
                                            }
                                        }
                                    });
                                }, 100);

                                //回调
                                callback();
                            }

                        },
                        beforeSend: function (request) {
                            $("#load").show();
                        },
                        complete: function (XMLHttpRequest, textStatus) {
                            $("#load").hide();
                        }
                    });
                }

            }


            $(document).ready(function () {
                if (document.getElementById("home-userDynamic") != null) {
                    //页码
                    var page = 1;
                    //滚动到底部触发翻页
                    var stop = false;//触发开关，防止多次调用事件


                    queryUserDynamicList(function () {
                        stop = true;
                    }, page);


                    $(window).scroll(function () {
                        //当内容滚动到底部时加载新的内容 100为当距离最底部100个像素时开始加载.
                        if ($(this).scrollTop() + $(window).height() + 100 >= $(document).height() && $(this).scrollTop() > 100) {
                            if (stop == true) {
                                stop = false;
                                page++;//当前要加载的页码
                                queryUserDynamicList(function () {
                                    stop = true;
                                }, page);
                            }
                        }
                    });
                }
            });
        </script>


        <script type="text/javascript">
            // 获取随机数
            function getRandom(m) {
                //生成的随机数截取m位，生成的随机数最大不超过13位，能保证首位不为0
                m = m > 13 ? 13 : m;
                var num = Math.random().toString();
                if (num.substr(num.length - m, 1) === '0') {
                    return getRandom(m);
                }
                return num.substring(num.length - m);
            }

            //设置播放器标签
            function setPlayerTag() {
                //获取<player>标签属性
                $(".topicContent").find("player").each(function () {
                    var random = getRandom(13);
                    var id = "player_" + random;
                    var url = $(this).attr("url");
                    var cover = $(this).attr("cover");//封面
                    var thumbnail = $(this).attr("thumbnail");//缩略图
                    //设置Id
                    $(this).attr("id", id);

                    if (cover != undefined && cover != "") {
                        var node = '<img class="cover" src="' + cover + '"/><span class="buttonCircle"><span class="iconBox"><i class="cms-control-play playIcon"></i></span></span>';

                        $(this).append(node);
                    } else {
                        var node = '<span class="buttonCircle"><span class="iconBox"><i class="cms-control-play playIcon"></i></span></span>';

                        $(this).append(node);
                    }


                    $(this).click(function () {
                        $(this).unbind('click');//解绑事件

                        if (url == "") {//如果视频处理中
                            var dp = new DPlayer({
                                container: document.getElementById(id),//播放器容器元素
                                screenshot: false,//开启截图，如果开启，视频和视频封面需要开启跨域
                                video: {}
                            });
                            insertProcess(id);
                        } else {
                            if (cover != undefined && cover != "" && thumbnail != undefined && thumbnail != "") {//切片视频
                                var dp = new DPlayer({
                                    container: document.getElementById(id),//播放器容器元素
                                    screenshot: false,//开启截图，如果开启，视频和视频封面需要开启跨域
                                    hotkey: true,
                                    preload: 'none', //禁止视频预加载
                                    video: {
                                        url: url,
                                        type: 'hls',
                                        pic: cover,//视频封面
                                        thumbnails: thumbnail//视频预览图
                                    }
                                });
                                dp.play();//播放视频

                            } else {
                                var dp = new DPlayer({
                                    container: document.getElementById(id),//播放器容器元素
                                    screenshot: false,//开启截图，如果开启，视频和视频封面需要开启跨域

                                    video: {
                                        url: url
                                    }
                                });
                                dp.play();//播放视频
                            }
                        }
                    });
                })
            }

            //插入处理提示层
            function insertProcess(id) {
                $("#" + id).prepend("<div class='dplayer-process'><div class='box'><div class='prompt'>视频处理中，请稍后再刷新</div></div></div>");
            }

        </script>

        <!-- 代码高亮显示 -->
        <script type="text/javascript">
            //代码语言类
            function languageClassName(originalClass, newClass) {
                var o = new Object()
                o.originalClass = originalClass;//原始样式标签名称
                o.newClass = newClass;//新样式标签名称
                return o;
            }

            //代码高亮
            function codeHighlight() {
                //代码语言映射集合
                var languageMapping_arr = new Array();
                var languageClassName_xml = languageClassName("lang-xml", "language-xml");
                languageMapping_arr.push(languageClassName_xml);
                var languageClassName_css = languageClassName("lang-css", "language-css");
                languageMapping_arr.push(languageClassName_css);
                var languageClassName_html = languageClassName("lang-html", "language-html");
                languageMapping_arr.push(languageClassName_html);
                var languageClassName_js = languageClassName("lang-js", "language-JavaScript");
                languageMapping_arr.push(languageClassName_js);
                var languageClassName_java = languageClassName("lang-java", "language-java");
                languageMapping_arr.push(languageClassName_java);
                var languageClassName_pl = languageClassName("lang-pl", "language-perl");
                languageMapping_arr.push(languageClassName_pl);
                var languageClassName_py = languageClassName("lang-py", "language-python");
                languageMapping_arr.push(languageClassName_py);
                var languageClassName_rb = languageClassName("lang-rb", "language-ruby");
                languageMapping_arr.push(languageClassName_rb);
                var languageClassName_vb = languageClassName("lang-vb", "language-VB.Net");
                languageMapping_arr.push(languageClassName_vb);
                var languageClassName_cpp = languageClassName("lang-cpp", "language-C++");
                languageMapping_arr.push(languageClassName_cpp);
                var languageClassName_cs = languageClassName("lang-cs", "language-C#");
                languageMapping_arr.push(languageClassName_cs);
                var languageClassName_bsh = languageClassName("lang-bsh", "language-Bash + Shell");
                languageMapping_arr.push(languageClassName_bsh);


                var doc_pre = $(".topicContent").find('pre[class^="prettyprint"]');
                doc_pre.each(function () {
                    var class_val = $(this).attr('class');
                    var lan_class = "";
                    var class_arr = new Array();
                    class_arr = class_val.split(' ');
                    for (var i = 0; i < class_arr.length; i++) {
                        var className = $.trim(class_arr[i]);

                        if (className != null && className != "") {
                            if (className.lastIndexOf('lang-', 0) === 0) {
                                lan_class = className;
                                break;
                            }
                        }
                    }

                    for (var i = 0; i < languageMapping_arr.length; i++) {
                        var languageMapping = languageMapping_arr[i];
                        if (languageMapping.originalClass == lan_class) {
                            var pre_content = '<code>' + $(this).html() + '</code>';
                            $(this).html(pre_content);
                            $(this).attr("class", 'line-numbers ' + languageMapping.newClass);
                        }
                    }
                    if (lan_class == "") {
                        var pre_content = '<code>' + $(this).html() + '</code>';
                        $(this).html(pre_content);
                        $(this).attr("class", 'line-numbers language-markup');
                    }

                    var code = $(this).find('code')[0];

                    //渲染
                    Prism.highlightElement(code, false, function () {
                    });
                });
            }
        </script>
    </div>
</div>


<!-- 引入页脚 -->
<div th:include="public/newPublic_3"></div>


</body>
</html>